package com.neuedu.spring.live;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

public class MyPerson implements InitializingBean, DisposableBean {


    public MyPerson() {
        System.out.println("实例化 Bean MyPerson");
    }

    private String name;
    private Integer age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
        System.out.println("依赖注入属性：name");
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
        System.out.println("依赖注入属性：age");
    }

    public void afterPropertiesSet() throws Exception {
        System.out.println("MyPerson.afterPropertiesSet");

        //
    }

    public void destroy() throws Exception {
        System.out.println("销毁Bean时执行 MyPerson");
    }
}
